<!DOCTYPE html>
<html lang="en" class="page-fill" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>更改承运商信息</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/css/oksub.css">
    <script type="text/javascript" src="/lib/loading/okLoading.js"></script>
</head>
<body>
<div class="ok-body">
    <!--form表单-->
    <form class="layui-form ok-form" lay-filter="filter">
        <div class="layui-form-item">
            <label class="layui-form-label">编号ID</label>
            <div class="layui-input-block">
                <input type="text" name="expressCompanyId"  autocomplete="off" class="layui-input" readonly="readonly"
                       lay-verify="expressCompanyId">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">承运商名称</label>
            <div class="layui-input-block">
                <input type="text" name="expressCompanyName"  autocomplete="off" class="layui-input"
                       lay-verify="expressCompanyName">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <input type="text" name="remarks" autocomplete="off" class="layui-input" lay-verify="remarks">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">联系方式</label>
            <div class="layui-input-block">
                <input type="text" name="phonenumber" autocomplete="off" class="layui-input" lay-verify="phonenumber">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">承运商编码</label>
            <div class="layui-input-block">
                <input type="text" name="expressCompanyCode" autocomplete="off" class="layui-input" lay-verify="expressCompanyCode">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="edit">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>
<!--js逻辑-->
<script src="/lib/layui/layui.js"></script>
<script>
    var initData;

    function initForm(data) {
        var jsonString = JSON.stringify(data);
        initData = JSON.parse(jsonString);
    }

    layui.use(["element", "form", "okLayer", "okUtils"], function () {
        var form = layui.form;
        var okLayer = layui.okLayer;
        var okUtils = layui.okUtils;
        okLoading.close();
        form.val("filter", initData);




        form.on("submit(edit)", function (data) {

            okUtils.ajax("/api/company/edit", "post", data.field, true).done(function (response) {
                console.log(response);
                okLayer.greenTickMsg("编辑成功", function () {
                    parent.layer.close(parent.layer.getFrameIndex(window.name));
                });
            }).fail(function (error) {
                console.log(error)
            });
            return false;
        });
    })
</script>
</body>
</html>
